<template>
   <div>
  <div class="login">
    <el-form v-model="CatlogList" label-width="120px" class="login-box">
      <h3 class="login-title">分类修改</h3>


      <!-- <el-form-item label="商品ID" prop="proId" >
        <el-input type="text" placeholder="请输入ID" v-model="CatlogList.proId" />
      </el-form-item> -->
      <el-form-item label="分类编号" prop="catelogCode">
        <el-input type="text" placeholder="请输入ID" v-model="CatlogList.catelogCode" />
      </el-form-item>
      <el-form-item label="分类名" prop="catelogName">
        <el-input type="text" placeholder="请输入ID" v-model="CatlogList.catelogName" />
      </el-form-item>

     

      
     
        <el-button type="primary" @click="updateCatlogs()">修改</el-button>
        <router-link to="/admin/manageProductCatlog"> <el-button type="primary" >返回</el-button></router-link>
    
    </el-form>
</div>

</div>
</template>

<script>
export default {
  name:"CatlogUpdate",
  data(){
    return{
      catlogUpdateId:'',
      CatlogList:[{
        id:'',
      proId:'',
      catelogCode:'',
     catelogName:'',
  admin:''
   
      }]
    }
  },methods:{
    //用于获取修改用来回显的数据
    getCatlogdata:function(){
      this.catlogUpdateId=this.$route.params.updateId
      console.log(this.catlogUpdateId)
      this.$axios.get("/catlog/getCatlogdata",{params:{id:this.catlogUpdateId}}).then(res=>{
        this.CatlogList=res.data
        console.log(this.CatlogList)

      })
    },
    //用于修改
    updateCatlogs:function(){
      	var admin=localStorage.getItem("admin");
        this.CatlogList.admin=admin;
      this.$axios.get("/catlog/updateCatlogs",{params:this.CatlogList}).then(res=>{
        this.$router.push({
          path:"/admin/manageProductCatlog"
        })
      })
    }
  },
  mounted(){
    this.getCatlogdata()
  }

}
</script>

<style>
.login-box {
  border: 1px solid #DCDFE6;
  width: 600px;
  margin: 180px auto;
  padding: 35px 35px 15px 35px;
  border-radius: 5px;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  box-shadow: 0 0 25px #909399;
  position: absolute;
  top:-175px;
  left: 3px;
 
 
}

.login {
  max-width:600px;
  margin: 60px auto;
  background: #fff;
  padding: 20px 40px;
  border-radius: 10px;
  position: relative;
  z-index: 9;
 
}
</style>